RWTH - Mindstorms NXT Toolbox

SyncToMotor

Enables synchronization regulation for current active and specified motor

Contents

Syntax

SyncToMotor(OtherMotor)

Description

SyncToMotor(OtherMotor) sets the synchronization mode to the curren active motor (set by SetMotor) and the given motor port OtherMotor. The value OtherMotor can be addressed by the symbolic constants MOTOR_A , MOTOR_B and MOTOR_C analog to the labeling on the NXT Brick. The synchronization mode can be set off if the value OtherMotor is set equal to 'off'. The synchronization setting takes only affect with the next SendMotorSettings command.

This means that both motors will act as if they were connected through an axle. Motors with more load on them (rough underground) will automatically be corrected and regulated for example. This "synchronization regulation" is the setting you want to use when driving with your robot. Also turning (SetTurnRatio) only affects motors that are synced.

Note:

One motor can not be synchronized to itself. The synchronization mode and the speed regulation mode can be set only together at one time. Once a motor is synced to another motor, all settings set to it will be applied to both motors (until synchronisation is lost of course). Once 2 motors are synced, you effectively control 2 motors with 1 set of commands. This means, when calling SendMotorSettings, in fact 2 packets will be send to the 2 synced motors, hence you will experience about twice the lag than usual. Take this into consideration...

When using several motor commands with SyncToMotor statements, unexpected behaviour can occur, due to the NXTs internal error correction counters. Sometimes it can help to issue the commands NXT_ResetMotorPosition(port, true), NXT_ResetMotorPosition(port, false) and StopMotor(port, 'off') for each of both motors. Although this seems like a waste of packets, this can do the trick, especially when working with certain turn ratios (see SetTurnRatio).

Example

   SetMotor(MOTOR_B);
   	SyncToMotor(MOTOR_C);
   	SetPower(76);
   SendMotorSettings();

See also

SendMotorSettings, SetMotor, SetPower, SetTurnRatio

Signature